<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<script src="${host_url}/js/app/jquery.min.js"></script>
<script src="/js/app/dropload.min.js"></script>
<link rel="stylesheet" href="${host_url}/css/app/common.css">
<link rel="stylesheet"  href="${host_url}/css/app/dropload.css">
<link rel="stylesheet"  href="${host_url}/css/app/special_goodlist_web.css">

<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<title>会员升级</title>
<script type="text/javascript">
$(function(){
	/*  页数 */
	var page_index_all = 2;/*  全部 */
    /* dropload 加载分页 */
    <c:if test="${goodList.size()!=0}">
    	loadPagination("listAll",page_index_all,"logAll");
    </c:if> 
    <c:if test="${'ios'==os}">
    window.webkit.messageHandlers.ios_hide_right_menu.postMessage('');
    </c:if> 
});
function loadPagination(div_id, page_index, ul_id){
	$('#'+div_id).dropload({
        scrollArea : window,
        loadDownFn : function(me){
            $.ajax({
                type: 'get',
                url: 'specialGoodListWebItem?page_index='+page_index,
                dataType: 'text',
                beforeSend: function(request) {
    				request.setRequestHeader("AUTHORIZATION","${token}");
    				request.setRequestHeader("SECRET","${memberId}");
    				request.setRequestHeader("OS","${os}");
    			 }, 
                contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                success: function(msg){
                
                    if($.trim(msg)){
                		page_index++;
                    	$("#"+ul_id).append(msg);
                    	me.resetload();
                   	/*  如果没有数据 */
                    } else{
                        	/*  锁定 */
                        me.lock();
                        	/*  无数据 */
                        me.noData();
                        $("#"+div_id+" .dropload-load").html("已经到底了~");
                    } 
                },
	                error: function(xhr, type){
                    	/*  即使加载出错，也得重置 */
                    me.resetload();
                } 
            });
        }
    });
}

/*跳往商品详情*/
function fn_goGoodDetail(good_id,package_id) {
	window.webkit.messageHandlers.ios_open_page.postMessage('ProductDetailViewController:::goodId->'+good_id+':::isPackage->YES:::isBought->${isBought}:::packge_url->${settlementPackageGoodsOne_url}:::packageId->'+package_id);	
}
</script>
<body>
	<div class="main">
		<div class="goods-list-wrap">
			<div class="goods-list" id="listAll">
			<ul>
				<li id="logAll">
					<c:forEach items="${goodList}" var="g">
						<c:if test="${'ios'==os}">
							<div class="" onclick="fn_goGoodDetail(${g.good_id},${g.package_id})">
						</c:if>
				      	<c:if test="${'android'==os}">
							<div class="" onclick="android.startGoodsDetail('${g.good_id}','${settlementPackageGoodsOne_url}')">
						</c:if>
							<p><img src="${g.img}" alt=""></p>
							<p class="goods-name">${g.name}</p>
							<p class="vip-price">&yen;&nbsp;${g.default_price}<span>&yen;${g.market_price}</span></p>
						</div>
					</c:forEach>
				</li>
			</ul>
			</div>
		</div>
	</div>
</body>
</html>